import { ref } from "vue";
import { defineStore } from "pinia";
import { getCategoryApi, Category } from "@/apis/layout";

export const useCategoryStore = defineStore("category", () => {
  const category = ref([] as Category[]);
  const getCategory = async () => {
    await getCategoryApi().then((res) => {
      category.value = res;
    });
    console.log(JSON.stringify(category.value[0].children));
  };

  return { getCategory, category };
});
